﻿using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using PublishNews.Entities;

namespace Paperless.Migrations
{
    internal sealed class Configuration : DbMigrationsConfiguration<PublishNewsContext>
    {

        //Add-Migration name
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(PublishNewsContext context)
        {
            var category = new Category()
            {
                IsDefault = true,
                Name = "Default"
            };
            context.SaveChanges();

            var user = new User()
            {
                Id = "1",
                UserName = "admin",
                Email = "test@test.test",
                FullName = "administrator",
                IsAdministrator = true,
                PasswordHash = "AE8Ing///pQByPN67fR9SHHXTp1f9XC+Q5NjhmXHbcE1hVvObdthngRcpQSDiyy0VQ==",
                SecurityStamp = "17f6ccc3-e832-44f6-95cc-5d4bbddd98d1"
            };

            context.Users.AddOrUpdate(x => x.Id, user);

            context.SaveChanges();
        }
    }
}